<?php


class ArticlesImage extends CActiveRecord
{
	
	public function tableName()
	{
		return 'articles_image';
	}

	
	public function rules()
	{
		
		
		return array(
			array('articles_id, url', 'required'),
			array('articles_id, width, height, file_size, create_user_id, status, image_type, orientation', 'numerical', 'integerOnly'=>true),
			array('title', 'length', 'max'=>200),
			array('url', 'length', 'max'=>500),
			array('format', 'length', 'max'=>40),
			array('image_size_type', 'length', 'max'=>45),
			array('create_date', 'safe'),
			
			
			array('id, articles_id, title, url, width, height, file_size, format, create_date, create_user_id, status, image_type, image_size_type', 'safe', 'on'=>'search'),
		);
	}

	
	public function relations()
	{
		
		
		return array(
			'articles' => array(self::BELONGS_TO, 'Articles', 'articles_id'),
			'createUser' => array(self::BELONGS_TO, 'BackendUser', 'create_user_id'),
		);
	}

	
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'articles_id' => 'Articles',
			'title' => 'Title',
			'url' => 'Url',
			'width' => 'Width',
			'height' => 'Height',
			'file_size' => 'File Size',
			'format' => 'Format',
			'create_date' => 'Create Date',
			'create_user_id' => 'Create User',
			'status' => 'Status',
			'image_type' => 'Image Type',
			'image_size_type' => 'Image Size Type',
			'orientation' => 'Orientation',
		);
	}

	
	public function search()
	{
		

		$V0v5vsnfxezw=new CDbCriteria;

		$V0v5vsnfxezw->compare('id',$this->id);
		$V0v5vsnfxezw->compare('articles_id',$this->articles_id);
		$V0v5vsnfxezw->compare('title',$this->title,true);
		$V0v5vsnfxezw->compare('url',$this->url,true);
		$V0v5vsnfxezw->compare('width',$this->width);
		$V0v5vsnfxezw->compare('height',$this->height);
		$V0v5vsnfxezw->compare('file_size',$this->file_size);
		$V0v5vsnfxezw->compare('format',$this->format,true);
		$V0v5vsnfxezw->compare('create_date',$this->create_date,true);
		$V0v5vsnfxezw->compare('create_user_id',$this->create_user_id);
		$V0v5vsnfxezw->compare('status',$this->status);
		$V0v5vsnfxezw->compare('image_type',$this->image_type);
		$V0v5vsnfxezw->compare('image_size_type',$this->image_size_type,true);
		$V0v5vsnfxezw->compare('orientation',$this->orientation);

		return new CActiveDataProvider($this, array(
			'criteria'=>$V0v5vsnfxezw,
		));
	}

	
	public static function model($Vgmajjibziuy=__CLASS__)
	{
		return parent::model($Vgmajjibziuy);
	}
	
}
